package shootplane;

/**
 * 小蜜蜂类：继承FlyObject
 * 奖励、血量
 */
public class Bee extends FlyObject implements Award{
    private boolean flag = true;
    private int award;

    public Bee() {
        image = ShootGame.beeImg;
        width = image.getWidth();
        height = image.getHeight();
        x = (int) (Math.random() * (400 - width));
        y = -height;
        speed = 3;
        flood = 2;
        award = (int) (Math.random() * 2);//奖励类型：0/1
    }

    @Override
    public int getAward() {
        return award;
    }

    @Override
    public void move() {
        setY(getY() + getSpeed());
        if (getX() < 0) {
            flag = true;
        } else if (getX() > 400 - width) {
            flag = false;
        }
        if (flag) {
            setX(getX() + getSpeed() * 2);
        } else {
            setX(getX() - getSpeed() * 2);
        }
    }

    public int getFlood() {
        return flood;
    }

    public void setFlood(int flood) {
        this.flood = flood;
    }

}